﻿using Autofac;
using Autofac.Extras.DynamicProxy;
using EventHandlerDemo.Application.Orders;
using EventHandlerDemo.Infrastructure.Interceptors;

namespace EventHandlerDemo.Application
{
    public class ApplicationModule : Module
    {
        protected override void Load(ContainerBuilder builder)
        {
            builder.RegisterType<OrderAppService>()
                .As<IOrderAppService>()
                .InstancePerDependency()
                .EnableInterfaceInterceptors()
                .InterceptedBy(typeof(UowTransactionInterceptor));
        }
    }
}
